package com.mushuilingfeng.ddd.framework.timer;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author mushuilingfeng
 * @author
 */
public class DefaultTimer implements ITimer {
    private final Timer timer = new Timer();

    @Override
    public <T> Long start(long delay, T param, ITimerCallback<T> callback) {
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                callback.callback(param);
            }
        }, delay);
        return null;
    }

    @Override
    public void stop(Long timerId) {
        throw new IllegalArgumentException("不支持停止任务");
    }

}
